<template>
	<view>
		<h3>song</h3>
		<view class="playlist">
			<view class="playlist-items">
				<view v-for="(items, play) in currentsonglist" :key="play">
					<view class="playlist-items-1">
						<view><image class="img" :src="items.backgroundUrl" mode=""></image></view>
						<view class="nickname">
							<view>{{ items.nickname }}</view>
							<view>{{ items.signature }}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
import { search_list, search_list_all } from '@/network/https/search.js';
export default {
	props:["playlistname"],
	data() {
		return {
			currentsonglist: '',
			totalPage: 1, //有几页
			pageSize: 30, //每页几条
			currentPage: 1 //当前页数
		};
	},
	onReachBottom() {
		this.singlelist();
	},
	onLoad(val) {
		this.singlelist();
	},
	created() {
		this.singlelist();
	},
	methods: {
		async singlelist() {
			const parm = {
				keywords: this.playlistname,
				limit: this.pageSize,
				offset: this.currentPage,
				type: 1002
			};
			const { data: res } = await search_list_all(parm.keywords, parm.limit, parm.offset, parm.type);
			this.currentPage += 10;
			this.totalPage = res.userprofileCount;
			this.currentsonglist = [...this.currentsonglist, ...res.result.userprofiles];
			console.log('歌单', res);
		}
	}
};
</script>
<style lang="scss" scoped>
.playlist {
	background-color: #ffffff;
	width: 700rpx;
	box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
	margin: 30rpx auto;
	border-radius: 10rpx;
	.playlist-items {
		margin-left: 20rpx;
		padding-top: 20rpx;
		&-1 {
			display: flex;
			align-items: center;
			margin-top: 20rpx;
			.img {
				width: 130rpx;
				height: 130rpx;
				border-radius: 20rpx;
			}
			.nickname {
				margin-left: 30rpx;
				view:nth-child(1) {
					font-size: 34rpx;
				}
				view:nth-child(2) {
					font-size: 27rpx;
					width: 300rpx;
					white-space: normal;
					overflow: hidden;
					display: -webkit-box; //将元素设为盒子伸缩模型显示
					-webkit-box-orient: vertical; //伸缩方向设为垂直方向
					-webkit-line-clamp: 2; //超出3行隐藏，并显示省略号
				}
			}
		}
	}
}
</style>
